package com.example.scaffolding.ui.user;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.ViewModel;
import androidx.paging.LivePagedListBuilder;
import androidx.paging.PagedList;

import com.example.scaffolding.db.bean.User;
import com.example.scaffolding.db.dao.UserDao;

import java.util.List;

public class UserViewModel extends ViewModel {

    /**
     * test PagedList
     */
    public final LiveData<PagedList<User>> concertList;
    /**
     * livedata for RecyclerView
     */
    private LiveData<List<User>> listLiveData;


    public UserViewModel(UserDao userDao) {
        concertList = new LivePagedListBuilder<>(
                userDao.userById(), 4).build();
        listLiveData=userDao.getLiveDataUsers();
    }

    public LiveData<List<User>> getUsers() {
       return listLiveData;
    }


}